﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }

    public class TestControl : Canvas
    {
        protected override void OnRender(DrawingContext dc)
        {
            Pen pen = new Pen(Brushes.Red,5);
            dc.DrawRectangle(Brushes.White, pen, new Rect(400,400,200,100));
            FormattedText formattedText = new FormattedText(
                "Hello",
                new System.Globalization.CultureInfo("zh-ch"),
                FlowDirection.LeftToRight,
                new Typeface("Microsoft YaHei"),
                22,
                Brushes.Blue
                );
            dc.DrawText(formattedText, new Point(10, 10));
            RectangleGeometry rg = new RectangleGeometry(new Rect(100, 100, 90, 40));
            dc.DrawGeometry(Brushes.Orange, pen, rg);
            base.OnRender(dc);
        }
    }
}